import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Hone from '@/views/Hone'
import Layout from '@/views/Layout'
import User from '@/views/User'
import Search from '@/views/Search'
import SearchResult from '@/views/Search/SearchResult'
import ArticleDetail from '@/views/ArticleDetail'
import UserEdit from '@/views/User/UserEdit'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/hone'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      {
        path: 'hone',
        component: Hone
      },
      {
        path: 'user',
        component: User
      }

    ]
  },
  {
    path: '/search',
    component: Search
  },
  { // 搜素结果页面
    path: '/Search_result/:kw',
    component: SearchResult
  },
  {
    // 详情页
    path: '/detail',
    component: ArticleDetail
  },
  {
    // 用户编辑页面
    path: '/user_edit',
    component: UserEdit
  }
]

const router = new VueRouter({
  routes
})

export default router
